home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98b.txt
/
000127_icon-group-sender _Wed Jul 8 14:02:22 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id OAA02674
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Wed, 8 Jul 1998 14:02:16 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA28049; Wed, 8 Jul 1998 14:02:03 -0700
Message-Id: <199807081244.OAA00040@capway.com>
From: "Vladimir Grodzenski" <grodzens@capway.com>
To: David Starner <dstarner98@aasaa.ofe.org>
Date: Wed, 8 Jul 1998 14:44:08 +0000
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7BIT
Subject: Re: Stripping excessive spaces
Reply-To: <vladimir.grodzenski@capway.com>
Cc: icon-group@optima.CS.Arizona.EDU
Priority: urgent
In-Reply-To: <35A2750A.E12A0673@aasaa.ofe.org>
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 945
I'd write your procedure in this way:
procedure clip(s)
s ? {
tab(many(' '))
return trim(tab(0))
}
end
On 7 Jul 98 at 13:20, David Starner wrote:
> I've just started programming in Icon, and I came across the problem
> of removing all the starting and ending spaces from a string. This
> was my solution, but I think it's terribly inefficent. Can some one
> help me with a better way to do this?
>
> procedure clip(s1)
> if type(s1) == "null" then fail
> s1 ?:= {
> tab(many(' ')) & tab(0)
> }
> s1 := reverse(s1)
> s1 ?:= {
> tab(many(' ')) & tab(0)
> }
> s1 := reverse(s1)
> return s1
> end
> --
> David Starner - dvdeug@hotmail.com, dstarner98@aasaa.ofe.org
> GURPS: http://www.geocities.com/TimesSquare/Ring/7895/
>
>
Vladimir Grodzenski
=================================================
E-mail: vladimir.grodzenski@capway.com
CompuServe: 100700,526
=================================================